<?php
class At_Debug{
	static function log( $str, $prefix=null ){
		static $fp;
		$pfx = '';

		if( ! is_string( $str ) ){
			$str = print_r( $str, true );
		}

		if( null == $fp ){
			$fp = fopen('/tmp/debug.log', 'a+');
		}

		if( is_string( $prefix ) ){
			$pfx = rtrim( $prefix, ':' ) . ":\n";
		}

		fwrite( $fp, sprintf("%s%s\n", $pfx, $str) );
	}
}
